<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>变量的解构赋值</title>
</head>

<body>
    <script>
        // ES6允许按照一定模式从数组和对象中提取值，对变量进行赋值，
        // 这被称为解构赋值。
        //1．数组的结构
        // const F4 = ['A', 'B', 'C', 'D'];
        // let [a, b, c, d] = F4;

        // console.log(a, b, c, d);

        //2．对象的解构
        const zhao = {
            name: 'A',
            age: 80,
            xiaopin: function () {
                console.log('我可以演小品');
            }
        };

        let { name, age, xiaopin } = zhao;

        console.log(name, age, xiaopin);
        xiaopin();

    </script>
</body>

</html>